<?php $this->load->view("general/header");?>
<div id="view_invoice" class="page_">
    <div class="form">              
        <div class="form_header">Lihat Daftar Invoice</div>
        <div class="content_data">
        <form method="post" action="<?php echo site_url("invoice/index");?>">
         <div id="placeResult">
        </div> 
        <div id="filter">
        	<strong>Filter</strong>: <br />
			Status Pelunasan <select id="paystatus">
            <option value="">::: Select :::</option>
            <option value="lunas">Lunas</option>
            <option value="Belum Bayar">Belum Bayar</option>
            <option value="Belum Lunas">Belum Lunas</option>
            </select>
            &nbsp;Status Keterlambatan <select id="duestatus">
            <option value="">::: Select :::</option>
            <option value="Terlambat">Terlambat</option>
            <option value="Belum Terlambat">Belum Terlambat</option>
            </select>
        </div>
        <div id="selectplace" align="right">
        	Lakukan pencarian berdasarkan:
            <select id="selectjenis">
            	<option value="">::: Select :::</option>
            	<option value="nomor">No Invoice</option>
                <option value="customer">Nama PT</option>
                
            </select>
            <input type="text" id="inputjenis" placeholder="Masukan kata kunci"/>
          <input type="button" name="btnSearch" value="Cari" class="button_red" onclick="javascript:invoJenisBarang(
                                                        '#selectjenis', '#inputjenis', '#searchPlace', '0')"/>
        </div>
        <div id="searchPlace">
        <div id="pager1" class="pager1">
        <table id="background-image"> 
            <thead> 
            	<?php if(empty($invoice)){
					?>
                    <tr>
                    	<td colspan="7" align="center">Tidak ada invoice</td>
                    </tr>
                    <?php
				}else{?>
                <tr> 
                	<th></th>
                    <th>No Invoice</th>
                    <th>Perusahaan</th>
                    <th>Nama</th> 
                    <th>Tgl Transfer</th>               
                    <th>Transfer</th>
                    <th>Status</th>
                    <th>Due</th>
                    <th>Action</th>
                </tr> 
            </thead> 
            <tbody> 
            	
           		<?php $i=0; foreach ($invoice as $invoice1){?>
					<tr id="tr_<?php echo $invoice1['invoice_no'];?>" >
                <!--onclick="javascript:invoDet(
                        '#invo_<?php echo $invoice1['invoice_id'];?>', '#placeResult', 
                        '<?php echo $invoice1['invoice_id'];?>', '0')"-->
                        <td><input type="checkbox" name="invoviewcheck[]" id="invoviewcheck[]"  value="<?php echo $invoice1['invoice_no']?>"/></td>
                        <td id="td_<?php echo $invoice1['invoice_no'];?>"><?php echo $invoice1['invoice_no'];?></td> 
                        <td><?php echo $invoice1['pt_name'];?></td>
                        <td><?php echo $invoice1['customer_name'];?></td>
                        <td><?php echo $invoice1['tglBayar'];?></td>  
                        <td><?php echo $invoice1['paymethod'];?></td> 
                        <input type="text" value="<?php echo $invoice1['total'];?>" id="tagihan_<?php echo  $invoice1['invoice_no'];?>" style="display:none" />
                        <input type="text" value="<?php echo $invoice1['paymethod'];?>" id="method_<?php echo  $invoice1['invoice_no'];?>" style="display:none" />
                        <input type="text" value="<?php echo $invoice1['tglBayar'];?>" id="tanggal_<?php echo  $invoice1['invoice_no'];?>" style="display:none" />
                        <input type="text" value="<?php echo $invoice1['pt_name'];?>" id="perusahaan_<?php echo  $invoice1['invoice_no'];?>" style="display:none" />
                        <input type="text" value="<?php echo $invoice1['duedate'];?>" id="due_<?php echo  $invoice1['invoice_no'];?>" style="display:none" />
                        <input type="text" value="<?php echo $invoice1['bayar'];?>" id="bayar_<?php echo  $invoice1['invoice_no'];?>" style="display:none" />
                      
                        <td><?php 
                            if	($invoice1['status']=="Belum Bayar"){
                                    ?><div id="div_<?php echo $invoice1['invoice_no'];?>" class="ajaxbayar" style="cursor:pointer"><font color="#FF0000">Belum Bayar</font></div>
                                <?php } else if($invoice1['status']=="Belum Lunas"){ ?>
                                    <div id="div_<?php echo $invoice1['invoice_no'];?>" class="ajaxbayar" style="cursor:pointer"><font color="#FF9900">Belum Lunas</font></div> <?php
                                }else{?>
									<div id="div_<?php echo $invoice1['invoice_no'];?>" class="ajaxbayar" style="cursor:pointer"><font color="#00CC33">Lunas</font></div>
								<?php }?>
                        </td>
                        <td><?php 
                            if	($invoice1['status']=="Lunas"){
                                    ?><font color="#00FF33">Lunas</font>
                                <?php } else{ ?>
                                	<?php if($invoice1['due']=="Terlambat"){?>
										<font color="#FF0000">Terlambat</font>
									<?php }else{ ?>
                                    	<font color="#00FF00">Belum Terlambat</font>
									<?php }?>
								<?php }?>
                        </td> 
                       
                        <td><a href="<?php echo site_url('invoice/edit/' . $invoice1['invoice_no'])?>">View & Edit</a></td>
                    </tr> 
                    
				<?php $i++;} ?>
           		
       		
           
            </tbody> 
           
            </table> 
    		<div class="title" align="right">
           
        		<input type="submit" name="btnGener" value="Generate Pdf" class="button_red" />
           	          
            </div>
                        <div class="success" id="sukses"><?php echo (isset($success))?$success:"";?>&nbsp;</div>

            </form>
            <form>
                <img src="<?php echo base_url();?>img/first.png" class="first" title="back to first"/>
                <img src="<?php echo base_url();?>img/prev.png" class="prev" title="previous"/>
                <input type="text" class="pagedisplay"/>
                <img src="<?php echo base_url();?>img/next.png" class="next" title="next"/>
                <img src="<?php echo base_url();?>img/last.png" class="last" title="go to last"/>
               
                <select class="pagesize">
                    <option selected="selected"  value="10">10</option>
                	<option value="15">15</option>
                    
                </select>
            
        	</form>
            
            </div>
            <?php }?>
    	</div>
       
    </div>      
    
</div>

  <?php /*================================================================*/
		// add payterm
		?>
         <div id="dialog-formA" title="Lakukan Pembayaran">
        Perusahaan: <div id="headDialog1Bill" class="headdiag"></div>
       
    	
 
            <form>
            <fieldset>
                <label for="tagihan">Tagihan</label>
                <input type="text" name="tagihan" id="tagihan" class="text ui-widget-content ui-corner-all" disabled="disabled" />
                <label for="bayar">Bayar</label>
                <input type="text" name="bayar" id="bayar" value="" class="text ui-widget-content ui-corner-all"/>
                <label for="tanggal">Tanggal Bayar(cnth: 08 Nov 2012)</label>
                <input type="text" name="tanggal" id="tanggal" class="text ui-widget-content ui-corner-all" />
                <label for="melalui">Bayar Melalui</label>
                <input type="text" name="melalui" id="melalui" value="" class="text ui-widget-content ui-corner-all" />
                
            </fieldset>
            </form>
        </div>
 
 

<?php $this->load->view("general/footer");?>